home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / tcoop.arc / TCOOP2.ARC / TXSCROLL.H < prev    next >
Encoding:
C/C++ Source or Header  |  1991-10-26  |  2.4 KB  |  85 lines

  1. // txscroll.h: Implements scrollable windows in text mode 
  2.  
  3. #ifndef H_TXSCROLL
  4. #define H_TXSCROLL
  5.  
  6. #include "wsotxscr.h"
  7.  
  8. // Scroll bar event code
  9. const int HzScrollMove = 0xfe00; 
  10. const int VtScrollMove = 0xfe01;
  11.  
  12. enum BarOrient { HzOrient, VtOrient };
  13.  
  14. // The slider frame type sets up a "frame" that's simply
  15. // a character bar with two arrows at the end. The bar
  16. // can be either horizontal or vertical. 
  17.  
  18. class ScrollFrame : public Tfso {
  19. public:
  20.   BarOrient Orientation;
  21.   // Correction: pg 292, Cp passed by reference, not by
  22.   //             pointer as in book
  23.   ScrollFrame(BarOrient Orient, ColorPak &Cp);
  24.   virtual void SetSize(int W, int H);
  25.   virtual void SetLocn(int Xl, int Y);
  26.   virtual void DrawFrame(char Ba, char Attr);
  27. };
  28.  
  29. // The Slider Button Type 
  30.  
  31. class Slider : public Wso {
  32. public:
  33.   // Correction: pg 293, Cp passed by reference, not
  34.   //             by pointer as in book
  35.   Slider(ColorPak &Cp) : Wso(0x00, Swappable, Cp) { ; }
  36.   virtual void Draw(void);
  37.   virtual void OnMouseDown(MsgPkt &M);
  38.   virtual void Move(int X, int Y);
  39.   virtual void OnKeyStroke(MsgPkt &M);
  40. };
  41.  
  42. // The slider bar type. We inherit from Iso, and set the panel
  43. //  of the Iso to be a slider frame. 
  44.  
  45. class ScrollBar : public Iso {
  46. public:
  47.   Slider *Slide;
  48.   int DelayCntr, DelayLimit;
  49.   int InhibitMessage;
  50.   // Correction: pg 293, Cp passed by reference, not by
  51.   //             pointer as in book
  52.   ScrollBar(BarOrient Orient, ColorPak &Cp);
  53.   virtual void Draw(void);
  54.   virtual void Redraw(void);
  55.   virtual void Open(Iso *B, int X, int Y);
  56.   virtual void BorderHandler(MsgPkt &M); 
  57.   virtual void OnMouseDown(MsgPkt &M);
  58.   virtual void OnMouseStillDown(MsgPkt &M);
  59.   virtual void SendScrollPosn(void);
  60.   virtual void RcvScrollPosn(float P, BarOrient Which);
  61.   virtual void OnKeyStroke(MsgPkt &M); 
  62. };
  63.  
  64. // An Abstract Scroll Window Screen Object Type 
  65.  
  66. class Swso : public Wso {
  67. public:
  68.   ScrollBar *HzSlide, *VtSlide;
  69.   // Correction: pg 293, Cp should be passed by reference,
  70.   //             not by pointer as in book
  71.   Swso(int Fa, ColorPak &Cp);
  72.   virtual void SetSize(int W, int H);
  73.   virtual void Stretch(int W, int H);
  74.   virtual void Open(Iso *B, int X, int Y);
  75.   virtual void Redraw(void);
  76.   virtual void Prompt(void);
  77.   virtual void UnPrompt(void);
  78.   virtual void SendScrollPosn(void) { ; }
  79.   virtual void RcvScrollPosn(float, BarOrient) { ; }
  80.   virtual void Dispatch(MsgPkt &M); 
  81. };
  82.  
  83. #endif
  84.  
  85.